<template>
	<uni-popup ref="popup" type="bottom">
		<view class="content">
			<view class="hd">
				<text class="title">联系客服</text>
				<icon class="iconfont icon" @click="close()">&#xe733;</icon>
			</view>
			<view class="bd">
				<view class="item">
					<text class="strong">客服QQ号：{{config.customer.qq_operate}}</text>
				</view>
				<view class="item">
					<text class="strong">客服电话：{{config.customer.mobile}}</text>
					<text class="small">(接听服务时间：9:00-19:00) </text>
				</view>
			</view>
			<view class="ft">
				<button type="default" class="btn btn-qq" hover-class="btnClickStyle" @click="copy()">复制QQ号</button>
				<button type="default" class="btn btn-mobile" hover-class="btnClickStyle" @click="call()">拨打电话</button>
			</view>
		</view>
	</uni-popup>
</template>
<script setup>
	import { ref, reactive, computed } from 'vue';
	import { showCopy } from '@/common/hooks/useShow.js';
	import config from '@/uni.config.js';
	const popup = ref(null);
	// 复制QQ号
	function copy() {
		showCopy({
			data: config.customer.qq_operate,
			title: '复制QQ成功',
			icon: 'none'
		});
		close();
	}
	// 打电话
	function call() {
		uni.makePhoneCall({
			phoneNumber: config.customer.mobile,
			fail() {}
		});
		close();
	}

	function open(item) {
		popup.value.open();
	}

	function close() {
		popup.value.close();
	}
	defineExpose({
		open,
		close
	})
</script>
<style scoped lang="scss">
	@import '@/common/css/base.scss';
	@import '@/common/css/form.scss';
	.content {
		width: 100%;
		border-radius: 16rpx 16rpx 0 0;
		background-color: #fff;
	}
	.hd {
		@include flex;
		height: 110rpx;
		padding: 0 28rpx;
		border-bottom: 1px solid #ddd;
		.title {
			font-size: 36rpx;
			color: #000;
		}
		.icon {
			font-size: 36rpx;
			color: #666;
		}
	}
	.bd {
		padding: 20rpx 50rpx;
		.item {
			margin-top: 30rpx;
			font-size: 30rpx;
			color: #666;
			.small {
				display: block;
				font-size: 22rpx;
			}
		}
	}
	.ft {
		@include flex(row, center);
		height: 150rpx;
		margin: 0 -15rpx;
		padding: 0 28rpx;
		.btn {
			flex: 1;
			height: 80rpx;
			line-height: 76rpx;
			margin: 0 15rpx;
			border: 1px solid $color;
			border-radius: 40rpx;
			text-align: center;
			background: $color;
			font-size: 32rpx;
			color: #fff;
			&-qq {
				background-color: #fff;
				color: $color;
			}
		}
	}
</style>
